home *** CD-ROM | disk | FTP | other *** search
/ Digitalfoto 118 / Digitalfoto 118.iso / mac / programas / 00 / start.swf / scripts / __Packages / com / robertpenner / easing / Elastic.as < prev    next >
Text File  |  2009-11-16  |  3KB  |  115 lines

  1. class com.robertpenner.easing.Elastic
  2. {
  3.    function Elastic()
  4.    {
  5.    }
  6.    static function easeIn(t, b, c, d, a, p)
  7.    {
  8.       if(t == 0)
  9.       {
  10.          return b;
  11.       }
  12.       if((t /= d) == 1)
  13.       {
  14.          return b + c;
  15.       }
  16.       if(!p)
  17.       {
  18.          p = d * 0.3;
  19.       }
  20.       if(!a || a < Math.abs(c))
  21.       {
  22.          a = c;
  23.          var _loc7_ = p / 4;
  24.       }
  25.       else
  26.       {
  27.          _loc7_ = p / 6.283185307179586 * Math.asin(c / a);
  28.       }
  29.       return - a * Math.pow(2,10 * (t -= 1)) * Math.sin((t * d - _loc7_) * 6.283185307179586 / p) + b;
  30.    }
  31.    static function easeOut(t, b, c, d, a, p)
  32.    {
  33.       if(t == 0)
  34.       {
  35.          return b;
  36.       }
  37.       if((t /= d) == 1)
  38.       {
  39.          return b + c;
  40.       }
  41.       if(!p)
  42.       {
  43.          p = d * 0.3;
  44.       }
  45.       if(!a || a < Math.abs(c))
  46.       {
  47.          a = c;
  48.          var _loc7_ = p / 4;
  49.       }
  50.       else
  51.       {
  52.          _loc7_ = p / 6.283185307179586 * Math.asin(c / a);
  53.       }
  54.       return a * Math.pow(2,-10 * t) * Math.sin((t * d - _loc7_) * 6.283185307179586 / p) + c + b;
  55.    }
  56.    static function easeInOut(t, b, c, d, a, p)
  57.    {
  58.       if(t == 0)
  59.       {
  60.          return b;
  61.       }
  62.       if((t /= d / 2) == 2)
  63.       {
  64.          return b + c;
  65.       }
  66.       if(!p)
  67.       {
  68.          p = d * 0.44999999999999996;
  69.       }
  70.       if(!a || a < Math.abs(c))
  71.       {
  72.          a = c;
  73.          var _loc7_ = p / 4;
  74.       }
  75.       else
  76.       {
  77.          _loc7_ = p / 6.283185307179586 * Math.asin(c / a);
  78.       }
  79.       if(t < 1)
  80.       {
  81.          return -0.5 * (a * Math.pow(2,10 * (t -= 1)) * Math.sin((t * d - _loc7_) * 6.283185307179586 / p)) + b;
  82.       }
  83.       return a * Math.pow(2,-10 * (t -= 1)) * Math.sin((t * d - _loc7_) * 6.283185307179586 / p) * 0.5 + c + b;
  84.    }
  85.    static function easeOutIn(t, b, c, d, a, p)
  86.    {
  87.       if(t == 0)
  88.       {
  89.          return b;
  90.       }
  91.       if((t /= d / 2) == 2)
  92.       {
  93.          return b + c;
  94.       }
  95.       if(!p)
  96.       {
  97.          p = d * 0.44999999999999996;
  98.       }
  99.       if(!a || a < Math.abs(c))
  100.       {
  101.          a = c;
  102.          var _loc7_ = p / 4;
  103.       }
  104.       else
  105.       {
  106.          _loc7_ = p / 6.283185307179586 * Math.asin(c / a);
  107.       }
  108.       if(t < 1)
  109.       {
  110.          return 0.5 * (a * Math.pow(2,-10 * t) * Math.sin((t * d - _loc7_) * 6.283185307179586 / p)) + c / 2 + b;
  111.       }
  112.       return c / 2 + 0.5 * (a * Math.pow(2,10 * (t - 2)) * Math.sin((t * d - _loc7_) * 6.283185307179586 / p)) + b;
  113.    }
  114. }
  115.